#ifndef CHECKOUT_H
#define CHECKOUT_H

#include <QWidget>

#include "saledetail.h"
#include "personmember.h"

class PersonMember;
class InquireSql;

enum LastClickCheckout {lineEditRealPayment, lineEditMemberPays,
                lineEditCashPays, lineEditCUPPays, pushButtonCheckout};
enum payMode {memberPay, CUPPay, cashPay};

namespace Ui {
class Checkout;
}

class Checkout : public QWidget
{
    Q_OBJECT
    
public:
    explicit Checkout(QWidget *parent = 0);
    ~Checkout();
    void displayMemberInformation(const PersonMember&);

    bool eventFilter(QObject *target, QEvent *event);

//    void set_memberLevel(QString memberLevel)  {m_memberLevel = memberLevel;}

    void set_amountsReceivable(const QString&);

    void set_salesOrderFormNumber(const QString& salesOrderFormNumber)
    {m_salesOrderFormNumber = salesOrderFormNumber;}

    void set_quantity(const QString& quantity) {m_quantity = quantity;}

    void set_integration(const QString& integration) {m_integration = integration;}

    void set_staffID(const QString& staffID) {m_staffID = staffID;}

    void set_cost(const QString& cost) {m_cost = cost;}

    void set_salesDetailsList(const saleDetailList& salesDetailsList)
    {m_saleDetailList = salesDetailsList;}

signals:
    void signalInit();
    void updateMemberProfile();
    
private slots:
    void on_pushButtonCancel_clicked();

    void on_pushButtonF1MemberPays_clicked();

    void on_pushButtonF2CashPays_clicked();

    void on_pushButtonF3CUPPays_clicked();

    void on_lineEditRealPayment_editingFinished();

    void on_pushButtonCheckout_clicked();

    void on_lineEditRealPayment_textChanged(const QString &arg1);

    void on_lineEditCashPays_textChanged(const QString &arg1);

    void on_lineEditMemberPays_textChanged(const QString &arg1);

    void on_lineEditCUPPays_textChanged(const QString &arg1);

private:
    Ui::Checkout *ui;

    InquireSql *m_sql;

    PersonMember m_personMember;

    QString m_amountsReceivable;   
    QString m_salesOrderFormNumber;
    QString m_quantity;
    QString m_integration;
    QString m_staffID;
    QString m_cost;

    saleDetailList m_saleDetailList;

    int m_lastClick;
    bool m_isMember;
    int m_payMode;
};

#endif // CHECKOUT_H
